class PositionHistoryController < ApplicationController
  
  def nested
      @id = params[:id]
      @position_history = Position.find_by_sql(["select p.name 'position_name',seniority,t.name 'team_name',CONCAT_WS(', ',m.lastname,m.name) 'member',DATE_FORMAT(a.assignation_date,'%m/%d/%y') assignation_date,DATE_FORMAT(a.finish_date,'%m/%d/%y') finish_date, active"+
      " from positions p, assignations a, teams t,members m"+
      " where p.id = a.position_id"+
      " and p.team_id = t.id"+
      " and m.id = a.member_id"+
      " and p.id = ?"+
      " order by assignation_date desc;",params[:id]]);      
  end
end
